package com.yehui.algorithm.sword;

/**
 * Created by XuChunH on 2016/9/18.
 */
public class TreeDepth {

    public int solution(TreeNode pRoot){
        if(pRoot == null){
            return 0;
        }
        int leftDepth = solution(pRoot.left);
        int rightDepth = solution(pRoot.right);
        return 1 + (leftDepth > rightDepth ? leftDepth : rightDepth);
    }

}
